load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "netutil",
    srcs = [
        "loopback.go",
        "net.go",
        "srv.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/util/netutil",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/util/log",
        "//pkg/util/log/severity",
        "//pkg/util/netutil/addr",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "@com_github_cockroachdb_cmux//:cmux",
        "@com_github_cockroachdb_errors//:errors",
        "@org_golang_google_grpc//:go_default_library",
        "@org_golang_x_net//http2",
    ],
)

go_test(
    name = "netutil_test",
    srcs = [
        "net_test.go",
        "srv_test.go",
    ],
    embed = [":netutil"],
    deps = [
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_cmux//:cmux",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@org_golang_google_grpc//:go_default_library",
    ],
)
